package com.cy.law.utils;

import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;

public class XStreamDoubleConverter extends AbstractSingleValueConverter {
    public XStreamDoubleConverter() {
        super();
    }

    @Override
    public String toString(Object obj) {
        return super.toString(obj);
    }

    @Override
    public boolean canConvert(Class type) {
        return type == double.class || type == Double.class;
    }

    @Override
    public Object fromString(String str) {
        return isEmpty(str) ? null : Double.valueOf(str);
    }

    public static boolean isEmpty(Object str) {
        return (str == null || "".equals(str));
    }
}
